﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Pixysoft.Framework.Noebe
{
    interface IProxyConnection
    {
        IDbConnection GetConnection();

        void ReallyClose();

        /// <summary>
        /// 由于java没有dispose，dotnet有，而且会调用，所以不能被用户直接调用真正的dispose
        /// </summary>
        void ReallyDispose();

        string ConnectionId { get; }

        // THREAD SAFE 
        int GetStatementSize();

        // THREAD SAFE:: user request this connection. called by connection pool. if connection is close/dispose by other thread, return false.
        bool TryDoRequest();

        // THREAD SAFE:: drop the request after do request, would not use it.
        void CancelRequest();

        // get request times.
        int GetRequestTimes();

        /* set removed when over available */
        void SetRemoved();

        /* connection is timeout. */
        bool IsTimeout();

        ConnectionSnapshot CreateShapshot();
    }
}
